package com.useeinfo.oa.open.api.inspection;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.useeinfo.framework.extend.action.BaseAction;
import com.useeinfo.framework.sugar.func.file.FileUtils;
import com.useeinfo.framework.sugar.tools.Configuration;
import com.useeinfo.oa.common.config.ConstantKeyFilePath;
import com.useeinfo.oa.common.utils.ResultUtil.ResultDto;
import com.useeinfo.oa.modules.base.entity.Enterprise;
import com.useeinfo.oa.modules.inspection.biz.InspectionOrderBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * 巡检缓存工单
 */

@RestController
@RequestMapping("/api/inspectionCache")
public class InspectionCacheAPI extends BaseAction {

    @Autowired
    private InspectionOrderBiz inspectionOrderBiz;

    //缓存工单详情
    @RequestMapping("/cacheOrderInfo")
    @ResponseBody
    public ResultDto cacheOrderInfo(String id,boolean type){
        logger.info("缓存工单详情{},{}",id,type);
        return inspectionOrderBiz.cacheOrderInfo(id,type);
    }

    //缓存上传接口

    /**
     *
     * @param temporaryData  巡检内容
     * @param inspectionOrderId 巡检id
     * @param presenceDate 到场时间
     * @param presenceUser 到场人id
     * @param completeUser 完成人id
     * @param completeDate 完成时间
     * @param participantInputs 参与人信息
     * @param workProgress 工作流程
     * @param workLog 工作日志
     * @param enterpriseId 企业id
     * @param repairOrders 报修单
     * @return
     */
    @RequestMapping("/SaveCacheOrder")
    @ResponseBody
    public ResultDto SaveCacheOrder(String temporaryData, String inspectionOrderId, String presenceDate, String presenceUser, String completeUser, String completeDate, String participantInputs, String workProgress, String workLog, String enterpriseId,String repairOrders,String workRemark){


        return inspectionOrderBiz.saveCacheOrder(temporaryData,inspectionOrderId,presenceDate,presenceUser,completeUser,completeDate,participantInputs,workProgress,workLog,enterpriseId,repairOrders,workRemark);
    }


    public static void main(String[] args) {
        String str="";
        String savePath = FileUtils.GenerateImage(str, ConstantKeyFilePath.INSPECTION_IMG_DIR, ConstantKeyFilePath.INSPECTION_IMG_FIX, Configuration.getConfigurationByName("fileSaveRootPath"));
        System.out.println(savePath);

    }
}
